/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gruppo12;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Stefano
 */
@WebService(serviceName = "AnagraficaService")
public class AnagraficaService {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "inserimento")
    public Boolean inserimento(@WebParam(name = "Nome") String Nome, @WebParam(name = "Indirizzo") String Indirizzo, @WebParam(name = "Piva") String Piva, @WebParam(name = "Tel1") String Tel1, @WebParam(name = "Tel2") String Tel2, @WebParam(name = "Tel3") String Tel3, @WebParam(name = "Email1") String Email1, @WebParam(name = "Email2") String Email2, @WebParam(name = "Tipo") int Tipo) {
        MetodiAnagrafica gb = new MetodiAnagrafica();//TODO write your implementation code here:
        try{gb.InserimentoAnagrafica(Nome, Indirizzo, Piva, Tel1, Tel2, Tel3, Email1, Email2, Tipo);
            return true;
        }
        catch(Exception e){return false;}
      
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "controllo")
    public Boolean controllo(@WebParam(name = "value") String value, @WebParam(name = "key") String key) {
        
        try{Boolean ans =new DbConnection().controllo(value, key, "test.elencoanagrafica");return ans;}
        catch (Exception e){}//TODO write your implementation code here:
        return true;
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "visualizza")
    public String [][] visualizza(@WebParam(name = "tipo") int tipo) {
        MetodiAnagrafica gb = new MetodiAnagrafica();
        try{return gb.VisualizzaAnagrafica(tipo);}//TODO write your implementation code here:
        catch (Exception e){return null;}
       
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "cancella")
    public Boolean cancella(@WebParam(name = "key") String key)  {
        MetodiAnagrafica g =new MetodiAnagrafica();
        try {
            return( g.CancellaAnagrafica(key));//TODO write your implementation code here:
        } catch (SQLException ex) {
            Logger.getLogger(AnagraficaService.class.getName()).log(Level.SEVERE, null, ex);
            return(false);
        }
       
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "cerca")
    public java.lang.String[][] cerca(@WebParam(name = "filter") String filter,@WebParam(name = "tipo") Integer tipo,@WebParam(name = "colonna") String colonna) {
          MetodiAnagrafica g =new MetodiAnagrafica();
        try {
            return( g.CercaAnagrafica(filter,colonna,tipo));//TODO write your implementation code here:
        } catch (SQLException ex) {
            Logger.getLogger(AnagraficaService.class.getName()).log(Level.SEVERE, null, ex);
            return(null);
        }
    }

   

    /**
     * This is a sample web service operation
     */
    
}
